package com.csx.governance.traffic.adm.service.impl;

import com.csx.governance.traffic.adm.model.bo.GrayscalePublishmentBO;
import com.csx.governance.traffic.adm.model.dto.GrayscalePublishmentDTO;
import com.csx.governance.traffic.adm.model.dto.StageTypeDTO;
import com.csx.governance.traffic.adm.model.dto.StrategyTypeDTO;
import com.csx.governance.traffic.adm.model.pojo.PublishStage;
import com.csx.governance.traffic.adm.service.GrayscalePublishService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author cuisongxu
 * @date 2023/5/4 15:28
 */
@Service
public class GrayscalePublishServiceImpl implements GrayscalePublishService {

    @Override
    public List<GrayscalePublishmentDTO> getGrayscalePublishments() {
        return null;
    }

    @Override
    public GrayscalePublishmentDTO getGrayscalePublishment(String publishmentName) {
        return null;
    }

    @Override
    public void addGrayscalePublishment(GrayscalePublishmentBO grayscalePublishmentBO) {

    }

    @Override
    public void updateGrayscalePublishment(GrayscalePublishmentBO grayscalePublishmentBO) {

    }

    @Override
    public void deleteGrayscalePublishments(List<String> publishmentNames) {

    }

    @Override
    public List<StageTypeDTO> getStageTypes() {

        List<StageTypeDTO> res = new ArrayList<>();

        for (PublishStage.StageTypeEnum stageType :PublishStage.StageTypeEnum.values()){

            String name = stageType.name();
            String showName = stageType.getName();

            StageTypeDTO stageTypeDTO = new StageTypeDTO();
            stageTypeDTO.setName(name);
            stageTypeDTO.setShowName(showName);

            res.add(stageTypeDTO);
        }
        return res;
    }

    @Override
    public List<StrategyTypeDTO> getStrategyTypes() {
        List<StrategyTypeDTO> res = new ArrayList<>();

        for (PublishStage.StrategyTypeEnum strategyType :PublishStage.StrategyTypeEnum.values()){

            String name = strategyType.name();
            String showName = strategyType.getName();

            StrategyTypeDTO strategyTypeDTO = new StrategyTypeDTO();
            strategyTypeDTO.setName(name);
            strategyTypeDTO.setShowName(showName);

            res.add(strategyTypeDTO);
        }
        return res;
    }
}
